<template>
  <div>
    <button @click="$store.commit('increment')">+1</button>
    <button @click="$store.commit('decrement')">-1</button>
    <button @click="addTen">+10</button>
  </div>
</template>

<script>
import { INCREMENT_N } from "../store/mutation-types";
export default {
  setup() {
    return {};
  },
  methods: {
    addTen() {
      // this.$store.commit(INCREMENT_N, 10);
      this.$store.commit(INCREMENT_N, {
        counter: 10,
        name: "pengfan",
        age: 10,
      });
      // 另外一种风格
      // this.$store.commit({
      //   type: INCREMENT_N,
      //   counter: 20,
      //   name: "pengyutong",
      //   age: 21,
      // });
    },
  },
};
</script>

<style scoped>
</style>